﻿using System.Linq;
using System;
using System.Collections;
using System.Collections.Generic;

namespace System
{
    public static class ArrayExtensions
    {
        /// <summary>
        /// 数组为null或者没有元素返回false
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static bool IsEmpty(this Array array)
        {
            return array == null || array.Length < 1;
        }

        public static String[] ToStringArray(this Array array)
        {
            return array._ToString().ToArray();
        }

        static IEnumerable<string> _ToString(this Array array)
        {
            foreach (object item in array)
            {
                yield return item.ToString();
            }
        }
    }
}